#include <iostream>
#include <memory>
#include "UdpServer.hpp"
#include "Dict.hpp"
using namespace std;
using namespace dict_ns;
void Usage(string proc)
{
    cout << "Usage:\n\t" << proc << " local_port\n"
         << endl;
}
// ./udpserver port
int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        Usage(argv[0]);
        exit(USAGE_ERROR);
    }
    EnableScreen();
    //定义翻译模块
    Dict dict;
    // 网络部分
    uint16_t port = stoi(argv[1]);
    unique_ptr<Udpserver> usvr = make_unique<Udpserver>(port, bind(&Dict::Translate, &dict,placeholders::_1,placeholders::_2));
    usvr->InitServer();
    usvr->Start();

    return 0;
}